﻿/// <reference path="../Controls/BaseComplexValueControl.js" />
/// <reference path="BaseTreeNode.js" />
/// <reference path="../Data/Template.js" />

var $TreeView = TA.Turbo.Controls.TreeView = function TreeView(clientId)
{
	if (Function.IsInherit(arguments)) return;

	this.BaseComplexValueControl(clientId);

	this._templates = new $MarkupTemplateCollection();
}
$TreeView.Inherit(TA.Turbo.Controls.BaseComplexValueControl);
$TreeView.Inherit(TA.Turbo.Controls.TreeNodeContainer);

var ____a;
if (____a)
{
	$TreeView = TA.Turbo.Controls.BaseComplexValueControl;
	$TreeView.prototype.BaseComplexValueControl = new TA.Turbo.Controls.BaseComplexValueControl();

	$TreeView.prototype._divRootList = document.createElement("asd");
	$TreeView.prototype._templates = new $MarkupTemplateCollection();
}

$PropertyDefinition.Define($TreeView, "Nodes", "N", new $TreeNodeCollection(),
{
	Serializable: $TreeNodeCollection,
	OnChanged: function _OnNodesChanged()
	{
		this._RecreateNodes();
	}
});

$TreeView.DefineEvent(new $ServerEvent("LoadNodes"));


$TreeView.prototype.get_Owner = function get_Owner()
{
	return this;
}
$TreeView.prototype.get_ContainerElement = function get_ContainerElement()
{
	return this._divRootList;
}
$TreeView.prototype.get_NodeCollection = function get_NodeCollection()
{
	return this.get_Nodes();
}

$TreeView.prototype.get_Templates = function get_Templates()
{
	return this._templates;
}



$TreeView.prototype.Init = function Init()
{
	this.BaseComplexValueControl.Init.call(this);
	
	this._divRootList = this.get_Control().FindFirstChild("DIV");
}
$TreeView.prototype.Load = function Load()
{
	this.BaseComplexValueControl.Load.call(this);

	this._ParseChildren(this);
}
